package com.synchronize;

import java.util.Random;

public class Ticket {
    public Integer sum = 30;

    public synchronized Integer saleTicket() throws InterruptedException {
        if (sum > 0) {
            int k = sum--;
            return k;
        } else {
            return null;
        }
    }
}
